﻿ 
            function createLine(x1,y1,x2,y2,z)
            {
                
                if (x1 > x2)
                    return createLine(x2,y2,x1,y1);
                
                var imgPath;    
                
                imgPath = "line_dr.gif";
                
                if (y1 > y2)
                {
                    imgPath = "line_ur.gif";
                    var tmp = y2;
                    y2 = y1;
                    y1 = tmp;
                } 
                
                var ln = document.createElement('img');
                ln.setAttribute("src",imgPath);
                
                var width = Math.max(x2 - x1,1);
                var height = Math.max(y2 - y1,1);
                
                var styleStr = "position:absolute;"
                
                styleStr= styleStr + " width:"   + width  + "px;";
                styleStr= styleStr + " height:"  + height + "px;";
                styleStr= styleStr + " left:"    + x1     + "px;";
                styleStr= styleStr + " top:"     + y1     + "px;";
                styleStr= styleStr + " z-index:" + z      + ";";
                ln.setAttribute("style",styleStr);
                
                return ln;
                
            }
            